#ifndef _FPDF_EMB_CREATOR_H_
#define _FPDF_EMB_CREATOR_H_

#ifdef __cplusplus
extern "C" {
#endif

struct FPDFEMB_FILERW_ACCESS {
	/**
	 * Interface: GetSize
	 *		Get current size of the file
	 *
	 * @param[in] file			Pointer to this file access structure
	 * @return File size, in bytes. Implementation can return -1 for any error.
	 */
	unsigned int	(*GetSize)(struct FPDFEMB_FILERW_ACCESS* file);

	/**
	 * Interface: ReadBlock
	 *		Read a data block from the file
	 *
	 * @param[in] file			Pointer to this file access structure
	 * @param[in,out] buffer	Pointer to a buffer receiving read data
	 * @param[in] offset		Byte offset for the block, from beginning of the file
	 * @param[in] size			Number of bytes for the block.
	 * @return Error code, or FPDFERR_SUCCESS for success.
	 */
	FPDFEMB_RESULT	(*ReadBlock)(struct FPDFEMB_FILERW_ACCESS* file, void* buffer, 
									unsigned int offset, unsigned int size);

	/**
	 * Interface: WriteBlock
	 *		Write a data block to the file
	 *
	 * @param[in] file			Pointer to this file access structure
	 * @param[in] buffer		Pointer to a buffer containing write data
	 * @param[in] offset		Byte offset for the block, from beginning of the file
	 * @param[in] size			Number of bytes for the block.
	 * @return Error code, or FPDFERR_SUCCESS for success.
	 */
	FPDFEMB_RESULT	(*WriteBlock)(struct FPDFEMB_FILERW_ACCESS* file, const void* buffer,
									unsigned int offset, unsigned int size);
	/**
	 * Interface: Flush
	 *		Flushes a stream
	 *
	 * @param[in] file			Pointer to this file access structure
	 * @return Error code, or FPDFERR_SUCCESS for success.
	 */
	FPDFEMB_RESULT	(*Flush)(struct FPDFEMB_FILERW_ACCESS* file);

	void*		user;		/**< A user pointer, used by the application. */
};

/**
 * Function: FPDFEMB_CreateDocument
 *			Create an empty document and save on the disk 
 *
 * Comments:
 *			The file access should be opened using both read and write privilege.
 *
 * @param[in] file			Pointer to file access structure.
 *							This structure must be kept valid before next reloading.
 * @param[in] document		Document handle 
 * @return Error code. FPDFERR_SUCCESS for success.
 */
FPDFEMB_RESULT FPDFEMB_CreateDocument(FPDFEMB_FILERW_ACCESS* file, FPDFEMB_DOCUMENT* pDoc);

#ifdef __cplusplus
};
#endif

#endif	// #ifdef _FPDF_EMB_CREATOR_H_